<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>所有商品</el-breadcrumb-item>
      <el-breadcrumb-item>数码影音</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <div>
        <span>分类：</span>
        <el-radio-group v-model="screenSize" size="small">
          <el-radio-button label="全部"></el-radio-button>
          <el-radio-button label="耳机"></el-radio-button>
          <el-radio-button label="音箱"></el-radio-button>
        </el-radio-group>
      </div>
    </el-card>
    <el-row :gutter="20" v-for="item in 2"  :key="item">
      <el-col :span="6" v-for="index in 4" :key="index">
        <el-card :body-style="{ padding: '0px' }">
          <router-link to="/GoodsDetail"><img :src=headsetList[item*index-1].src width="370" height="400" @click="changeSelectedItem(headsetList[item*index-1])"></router-link>
          <div class="item-Title"><span style="font-size: 26px;color: #000000;font-weight: 600;">{{ headsetList[item*index-1].title }}</span></div>
          <div class="item-Description"><span style="font-size: 12px;color: #000000;font-weight: 300;">{{ headsetList[item*index-1].description }}</span></div>
          <div class="item-Price"><span style="font-size: 25px;color: #FF0000;font-weight: 500;">{{ headsetList[item*index-1].price }}</span></div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
export default {
  data () {
    return {
      screenSize: '全部'
    }
  },
  computed: mapGetters({
    headsetList: 'getHeadsetList'
  }),
  methods: {
    changeSelectedItem (item) {
      this.$store.dispatch('changeSelectedItem', item)// 改变进入商品
    }
  }
}
</script>

<style scoped>
.el-row {
  margin-top: 20px;
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.box-card {
  margin-top: 20px;
  line-height: 40px;
  text-align: left;
  height: 90px;
  padding: 0px;
}
.item-Title {
  line-height: 40px;
  /*text-align: left;*/
  height: 40px;
  padding: 0px;
}
.item-Description {
  line-height: 40px;
  /*text-align: left;*/
  height: 40px;
  padding: 0px;
}
.item-Price {
  line-height: 40px;
  /*text-align: left;*/
  height: 40px;
  padding: 0px;
}
</style>
